<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>实验室管理系统
        
    </title>
    
    
    
<script src="<?php echo (JS_URL); ?>\assetce.js"></script>

    <link rel="stylesheet" href="<?php echo (CSS_URL); ?>\reset.css">
    <link rel="stylesheet" href="<?php echo (CSS_URL); ?>\style.css">
    <link rel="stylesheet" href="<?php echo (CSS_URL); ?>\common.css">
    <link rel="stylesheet" href="<?php echo (CSS_URL); ?>\fixedit.css">
    <link rel="stylesheet" href="<?php echo (CSS_URL); ?>\footer.css">
    <script src="<?php echo (JS_URL); ?>\jquery-3.2.1.min.js"></script>
    <script src="<?php echo (LIBS_URL); ?>\jquery.validate.js"></script>
    <script src="<?php echo (LIBS_URL); ?>\jquery.validate.messages_cn.js"></script>
    <link href="<?php echo (CSS_URL); ?>\bootstrap.css" rel="stylesheet">
    <script src="<?php echo (JS_URL); ?>\bootstrap.min.js"></script>
    <link href="<?php echo (CSS_URL); ?>\bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="<?php echo (LIBS_URL); ?>/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="<?php echo (LIBS_URL); ?>/bootstrap-datetimepicker.min.css">
    <script src="<?php echo (LIBS_URL); ?>/bootstrap-datetimepicker.fr.js"></script>
    <script src="<?php echo (LIBS_URL); ?>/bootstrap-datetimepicker.js"></script>
    <link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">
    
    
    
<script src="<?php echo (JS_URL); ?>\assetce.js"></script>

</head>
<style>
    .pagination a,.pagination span{
        position: relative;
        float: left;
        padding: 6px 12px;
        margin-left: -1px;
        line-height: 1.42857143;
        color: #337ab7;
        text-decoration: none;
        background-color: #fff;
        border: 1px solid #ddd;
    }
</style>
<body>
<!-- 页头和导航 -->
<div class="container-fluid">
    <div class="container-fluid top">
        <div class="personal">
            <a href="#" id="exit">
                <i class="fa fa-power-off"></i>
                <span>注销</span>
            </a>
            <a href="">林小明</a>
            <span>2017年12月12日</span>
            <span>星期六</span>
        </div>
    </div>
    <div class="container">
        <div class="logo">
            <img src="<?php echo (IMG_URL); ?>/logo.jpg" alt=""/>
            <span>东莞理工学院公用机房管理系统</span>
        </div>
        <!-- 导航 -->
        <div>
            <div class="navtop"></div>
            <div class="nav">
                <a style="margin-left:0px;" href="<?php echo U('index/index');?>">首页</a>
                <a href="<?php echo U('LabApply/labapply');?>">实验室申请</a>
                <a href="<?php echo U('InstrumentLend/index');?>">资产与耗材</a>
                <a href="<?php echo U('WarningList/index');?>">设备报障</a>
                <a href="<?php echo U('LostList/index');?>">失物招领</a>
                <a href="<?php echo U('Advice/index');?>">意见建议</a>
                <a href="<?php echo U('TeachAdvice/index');?>">教学环境评价</a>
                <a href="<?php echo U('NoticeList/index');?>">公告</a>
            </div>
        </div>
    </div>
</div>
<!-- 内容 -->

    <div class="container">
        <div class="menu_l" >
            <div class="Na" style="margin-left:13px;" ><span style="word-break:normal;"></span>
            </div>
            <dl id="dl1" class="close1">
                <dt  onclick="onelist(this)" style="background-color:#019858">
                    <span><img id="img0" src="images/right.png"/>仪器借用</span>
                </dt>
                <dd ><a href="<?php echo U('InstrumentLend/index');?>" style="color:#333333;text-decoration: none;"><span>借用仪器 </span></a></dd>
                <dd style="background-color:#019858"><a href="<?php echo U('MyAsset/index');?>" style="color:#333333;text-decoration: none;"><span>我的借用记录</span></a></dd>
            </dl>
            <dl id="dl2" class="close1">
                <dt  onclick="onelist(this)"> <span><img id="img1"src="images/right.png"/>耗材领取</span></dt>
                <dd style="background-color:#019858"><a href="<?php echo U('Material/index');?>" style="color:#333333;text-decoration: none;"><span>填写申请表</span></a></dd>
                <dd><a href="<?php echo U('MyMaterial/index');?>" style="color:#333333;text-decoration: none;"><span>我的领取记录</span></a></dd>
            </dl>
            <dl id="dl3" class="close1">
                <dt  onclick="onelist(this)" style="background-color:#019858"> <span><img img id="img2" src="images/right.png"/>申购</span></dt>
                <dd ><a href="<?php echo U('ApplicationApply/index');?>" style="color:#333333;text-decoration: none;"><span>仪器设备申购</span></a></dd>
                <dd   style="background-color:#019858"><a href="<?php echo U('MaterialApply/index');?>" style="color:#333333;text-decoration: none;"><span>耗材申购</span></a></dd>
            </dl>
        </div>
        <div class="lendForm" style="width:84%;float:right;text-align: center">
            <!--样式在common.css-->
            <div class="tipTitle" style="text-align: left">
                <i class="fa fa-smile-o fa-2x"></i>&nbsp;&nbsp;<span>资产借用</span>
            </div>
            <div style="margin-bottom: 20px;">
            <form action="<?php echo U('index');?>" method="get" id="myform">
                <label for="">校区：</label>
                <select class="form-control" style="width:120px;display:inline-block" name="campus" id="" onchange="submitForm()">
                   <?php if($campus==2): ?><option value="0" selected>全部</option>
                       <?php else: ?><option value="0">全部</option><?php endif; ?>
                    <?php if($campus==1): ?><option value="1" selected>松山湖</option>
                        <?php else: ?><option value="1">松山湖</option><?php endif; ?>
                    <?php if($campus==2): ?><option value="2" selected>莞城</option>
                        <?php else: ?><option value="2">莞城</option><?php endif; ?>
                </select>
                <?php if(isset($name) != 0): ?><input class="form-control" style="width:120px;display:inline-block" type="text" placeholder="请输入仪器名" name="search" value="<?php echo ($name); ?>">
                    <?php else: ?>
                <input class="form-control" style="width:120px;display:inline-block" type="text" placeholder="请输入仪器名" name="search"><?php endif; ?>
                <button class="btn btn-default" type="submit"><i class="fa fa-search"></i></button>
            </form>
            </div>
            <div>
            <table class="table" >
                <thead>
                  <tr>
                      <td>名称</td>
                      <td>型号</td>
                      <td>校区</td>
                      <td>使用方向</td>
                      <td>库存</td>
                      <td>操作</td>
                  </tr>
                </thead>
                <tbody>
                <?php if(is_array($asset)): foreach($asset as $k1=>$v1): ?><tr>
                        <td><?php echo ($v1["name"]); ?></td>
                        <td><?php echo ($v1["pattern"]); ?></td>
                        <?php if($v1['campus'] == 1): ?><td>松山湖</td>
                            <?php else: ?><td>莞城</td><?php endif; ?>
                            <td><?php echo ($v1["userway"]); ?></td>
                        <td id="count_sum" value="<?php echo ($v1["sum"]); ?>"><?php echo ($v1["sum"]); ?></td>
                        <td>
                            <button class="btn btn-default"  data-toggle="modal" data-target=".bs-example-modal-lg" onclick="Values('<?php echo ($v1["pattern"]); ?>','<?php echo ($v1["name"]); ?>')">
                                <i class="fa fa-smile-o"></i>&nbsp;借用</button>
                        </td>
                    </tr><?php endforeach; endif; ?>
                </tbody>
            </table>
                <nav class="fenye" aria-label="Page navigation">
                    <ul class="pagination">
                        <?php echo ($show); ?>
                    </ul>

                </nav>
               <div class="fenTotal">共 <?php echo ($count); ?> 条记录</div>
            </div>
        </div>
        <!--模态框-->
        <div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
            <div class="modal-dialog modal-lg" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title" id="myModalLabel"><i class="fa fa-smile-o"></i>&nbsp;填写仪器借用申请表</h4>
                    </div>
                    <div class="modal-body">
                        <!--样式在common.css-->
                        <form class="fixform" action="<?php echo U('lendForm');?>" method="post" id="inputForm">
                            <input type="hidden" id='id' name='pattern' value=''>
                            <input type="hidden" id='name' name='name' value=''>
                            <table class="lendform_table">
                                <tr>
                                    <td class="lend_label"><label for="">数&nbsp;量&nbsp;:</label></td>
                                    <td><input type="text" class="juli formpost" name="count" placeholder="请输入数量"/></td>
                                </tr>
                                <tr>
                                    <td class="lend_label"><label for="">使用地点&nbsp;:</label></td>
                                    <td><input type="text" class="formpost juli" name="place" placeholder="请输入使用地点"/></td>
                                </tr>
                                <tr>
                                    <td class="lend_label"><label for="">用途&nbsp;:</label></td>
                                    <td>
                                        <textarea type="text" class="formpost juli" name="use" placeholder="请输入用途"></textarea>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="lend_label"><label for="">预计归还日期&nbsp;:</label></td>
                                    <td>
                                        <div class='input-group date form_date' >
                                            <input name="reback_time" id="datetimepicker" type='text' class="formpost input-sm" readonly="readonly" placeholder="请输入预计归还日期"/><br/>
                                            <!--<span class="input-group-addon input-sm">-->
                  <!--<span class="glyphicon glyphicon-calendar"></span>-->
                <!--</span>-->
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td></td>
                                    <td>
                                        <button type="submit" class="btn allbutton">提交</button>
                                    </td>
                                </tr>
                            </table>
                        </form>
                    </div>
            </div>
        </div>
    </div>
        </div>

<!-- 页脚 -->


<div class="sfooter" style="margin-top: 30px;">
    <span>Copyright © 东莞理工学院教务处 All Rights Reserved</span><br/>
    <span>地址：广东省东莞市松山湖大学路1号 邮编：523808</span><br/>
    <span>电话：0769-22861099</span><br/>
</div>
<!-- 页脚结束 -->

</body>
</html>

    <script>
        var nana=document.getElementById('exit');
        nana.onclick=function(){
            var check=confirm("确认注销吗？");
            if(check){
                alert("注销成功");
            }else{

            }
        }
    </script>


    <script>
    //表单下拉框选择直接提交数据
    function submitForm(){
    //获取form表单对象
    var form = document.getElementById("myform");
    form.submit();//form表单提交
    }

    //table每列数据隐藏id
        function Values(ID,name) {
            $("#id").val(ID);
            $("#name").val(name);
        }
        //年月日选择框
    //选择年月日的       startView: 2,   minView: 2, format: 'yyyymmdd',
    $('#datetimepicker').datetimepicker({
        format: 'yyyy-mm-dd',
        weekStart: 1,
        autoclose: true,
        startView: 2,
        minView: 2,
        forceParse: false,
        language: 'zh-CN'
    });
//   表单验证
    var haha=$("#count_sum").text();
//    console.log(haha);
    $.validator.addMethod("buga", function(value) {
        return parseInt(value) <=parseInt(haha);
    }, '数量大于库存数量');

            $(document).ready(function(){

                $("#inputForm").validate({
                errorElement: "span",
                    rules: {
//                        count: {
//                            required: true,
//                            maxlength: haha
//                        },
                        count: "buga",
                        place:{
                            required: true
                        },
                        use:{
                            required:true
                        },
                        reback_time:{
                            required:true
                        }
                    },
                    messages: {
                        count: {
                            required: "*借用数量不能为空   ",
                            minlength:"*借用数量不可大于库存"
                        },
                        place: {
                            required: "*使用地点不能为空"
                        },
                        use:{
                            required: "*资产用途不能为空"
                        },
                        reback_time:{
                            required: "*归还时间不能为空"
                        },

                    },
                });
            });


 //-------------------------------
    </script>


    <!--导航变色-->
    <script>
        var nav=document.getElementsByClassName('nav')[0].getElementsByTagName('a');
        nav[2].className='active';
    </script>